IModel.SetFieldAt method ¶
Namespace: NextDesign.Core
Description¶
Sets the specified value at the specified index position of the specified field of this instance. If a value that cannot be set for the specified field is specified, an exception will be thrown. In addition, exception is not thrown even if the multiplicity upper limit constraint or path constraint of the field is violated.
argument¶
Name | Type | Description |
---|---|---|
fieldName | string | Field name Null or empty string cannot be specified. |
value | object | field value |
index | int | Position Specify the index where the start position is 0. |
Return value¶
- void
Exception¶
Name | Exception Class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | When null or empty string is specified in fieldName |
Field not found | ExtensionFieldNotFoundException | If the specified field is not found in this instance's metaclass |
Illegal field access | ExtensionIllegalFieldAccessException | When this method is executed for a field with a maximum multiplicity of 1 |
Invalid index range | ExtensionOutOfRangeException | If a negative number is specified for index , or if a value greater than the number of elements in the corresponding field is specified for index |
Does not match field type | ExtensionInvalidTypeException | value that does not match the field type. -A primitive type value or an enumerated value is specified in the class type field. br>-An incompatible class type was specified |
Illegal operation | ExtensionInvalidOperationException | If the model itself is a deleted model or temporary proxy If an inoperable field is specified in the field name -Product line feature assignment field -System.Core tag Assigned field |
Circular reference | ExtensionCircularReferenceException | When calling the owned field of the class type and specifying the call target of this method or its ancestor in the argument value |
Invalid model specified | ExtensionInvalidModelException | When deleted model or temporary proxy is specified in the value of field |
Annotation¶
About the values that can be set depending on the field type
The values that can be set depend on the field type as follows.
-
Primitive field (integer, real, boolean, string, rich text)
This method cannot be set.
-
Enumerated fields
This method cannot be set.
-
Class type field
You can set an instance of the IModel interface and null for a field of class type.
If a value of type IModel is specified, set the specified model instead of the model that was already set. At this time, the behavior differs depending on whether the field is owned or referenced.
- If owned, move the model specified by the argument as a child of the model that called the method. It also deletes the model that has already been set.
- In case of reference, add reference association with the model specified by the argument. In addition, the reference relation that existed with the already set model is deleted. The model that has already been set is not deleted.
If null is specified, only the model that has already been set will be unset.
- If you own, delete the already set model.
- In case of reference, delete the reference relation that existed with the already set model. The model that has already been set is not deleted.
When null is specified, the specified element is deleted and the following elements are moved forward.